#ifndef _TCPLIB_LISTENER_HPP_
#define _TCPLIB_LISTENER_HPP_

namespace tcplib{


class Listener
{
    int _fd;
    typedef void (*ACCEPTOR)(Listener *, void *, Connection *);

public:

    Listener(EventHub *event_hub == NULL);
    ~Listener();


    int start_listen(const NetAddr &addr);
    Connection *sync_accept(uint32_t timeout_ms);
    void async_accept(void (*acceptor)(Listener *, void *, Connection *));

    void close();
};


};


#endif


